package com.lwq.model.system;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.lwq.model.BaseEntity;
import lombok.Data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * Description:
 * Author: LiuWenQing
 * Datetime: 2021/6/10
 */
@Data
@TableName(value="sys_menu")
public class SysMenu extends BaseEntity implements Serializable {

    private static final long serialVersionUID = 1L;

    // 状态为启用
    public static final String ENABLE = "1";
    // 状态为禁用
    public static final String DISABLE = "2";

    public static final String CODE = "code";

    @TableId(type = IdType.ASSIGN_ID)
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;

    private String name;

    private String code;

    @JsonSerialize(using = ToStringSerializer.class)
    private Long parentId;

    private String parentName;

    private Integer sort;

    private String url;

    private String icon;

    private String status;

    @TableField(exist = false)
    private List<SysMenu> children = new ArrayList<>();

}
